﻿using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using System.Data.Entity;
using System.Xml.Serialization;

namespace Sovigaz.DataProvider
{
    public partial class SovigazDbContext
    {
        public DbSet<User> Users { get; set; }

        public DbSet<sp_User_SelectPermission> sp_User_SelectPermissionResult { get; set; }
    }

    [Table("Users")]
    public class User : AuditableEntity
    {
        public User()
        {
            IsActived = true;
            UserRoles = new List<UserRole>();
        }

        [Key]
        public int UserID { get; set; }

        public string Username { get; set; }

        public string Password { get; set; }

        public string FullName { get; set; }
        
        public string Position { get; set; }

        [NotMapped]
        public string PositionName { get; set; }

        public DateTime? StartDate { get; set; }

        public string Description { get; set; }

        [XmlIgnore]
        public ICollection<UserRole> UserRoles { get; set; }
    }

    public class sp_User_SelectPermission
    {
        [Key, Column(Order = 0)]
        public string SitemapID { get; set; }

        [Key, Column(Order = 1)]
        public int PermissionID { get; set; }

        public bool IsActived { get; set; }
    }
}